home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / BBEdit Lite 4.0.1 / BBEdit Lite Quickstart < prev    next >
Text File  |  1997-03-19  |  43KB  |  970 lines

  1. This QuickStart document provides a brief overview of some of the
  2. commands available in BBEdit Lite. For more general information about
  3. BBEdit Lite, consult the "About BBEdit Lite" document.
  4.  
  5. The topics covered in this document are:
  6.  
  7.     * Installation
  8.     * Creating and Saving Documents
  9.     * Editing Documents
  10.         - Key Equivalents
  11.     * More on Wrapping
  12.     * Printing
  13.     * Searching
  14.     * Multi-File Searching
  15.     * Preferences Dialog
  16.     * Parting Shots
  17.  
  18. ===
  19.  
  20. Installation
  21.  
  22. BBEdit Lite consists of the following major components:
  23.  
  24. *    The BBEdit Lite application itself
  25. *    The "BBEdit Extensions" folder, which contains plug-in code
  26.       modules that can provide specialized text processing or
  27.       utility functions 
  28.  
  29. Only the BBEdit Lite application file is required in order to run and
  30. use BBEdit Lite; you do not need to have any BBEdit extensions.
  31.  
  32. If you are planning to install the whole set of BBEdit Lite files,
  33. create a "BBEdit Lite Folder". Copy the application and the "BBEdit
  34. Extensions" folder into your BBEdit Lite Folder.
  35.  
  36. ===
  37.  
  38. Creating and Saving Documents
  39.  
  40. To create a new document within BBEdit Lite, choose "New" from the File
  41. menu. An empty editing window will be opened on the screen. You can type
  42. in this window, paste text from another document or application, or do
  43. anything else which causes text to be placed in this window.
  44.  
  45. Once you have opened a new window and done some basic editing, you can
  46. save your new document. To do this, choose the "Save As..." command from
  47. the File menu. Type in the name of your new file and click on "Save".
  48.  
  49. ===
  50.  
  51. Editing Documents
  52.  
  53. In terms of its basic editing functionality, BBEdit Lite behaves like any
  54. other word processor or text editor on the Macintosh: any typed
  55. characters are inserted at the insertion point; if there is a selection
  56. present, the selection is replaced by the first typed character, and the
  57. insertion point is placed after the first typed character.
  58.  
  59. The insertion point is indicated by a blinking vertical bar.
  60.  
  61. If there is any text selected in the active (or front) window, it is
  62. highlighted using your Mac's default highlight color. If there is text
  63. selected in a window that is inactive (not the front window), it is
  64. framed in the highlight color.
  65.  
  66. As you type, BBEdit Lite scrolls the window's contents so that the insertion
  67. point is visible. Unless you have the "Soft Wrap Text" option selected,
  68. the window may scroll horizontally as you type.
  69.  
  70. To move text from one place to another, select the text you wish to
  71. move, and choose the "Cut" command from the Edit menu. The selected text
  72. will be deleted, and placed in a special area called the "Clipboard".
  73. (The Clipboard always contains the last text that you cut or copied.)
  74. You can then use the "Paste" command on the Edit menu to place the text
  75. elsewhere in the document you are editing, or even in another window
  76. altogether. Also, any text that you cut or copy can be pasted into
  77. another application. You can place text in the Clipboard without
  78. deleting it by choosing "Copy" from the Edit menu.
  79.  
  80. When you Paste, the text that's in the Clipboard will replace the
  81. current selection (if there is one), or be inserted at the insertion
  82. point. Paste doesn't remove text from the Clipboard, so you can Paste as
  83. many times as you wish.
  84.  
  85. To delete selected text, hit the "Delete" key on your keyboard, or
  86. choose "Clear" from the Edit menu. If you have a keyboard with a numeric
  87. keypad on it, you can hit the "Clear" key on the keypad to delete the
  88. selected text.
  89.  
  90. To select all the text in the front editing window, choose "Select All"
  91. from the Edit menu. You can then cut, copy, or perform any other action
  92. that affects selected text.
  93.  
  94. BBEdit Lite provides an assortment of facilities for transforming text in
  95. various ways. The commands to transform text are all found under the
  96. Text menu:
  97.  
  98. *   Balance locates the pair of parentheses, braces, or brackets which
  99.     encloses the current selection range or insertion point. If there
  100.     are unmatched parentheses, braces, or brackets, BBEdit Lite will
  101.     beep.
  102.  
  103. *   Twiddle transposes the two characters on either side of the
  104.     insertion point, or at either end of the selected text.
  105.  
  106. *   Change Case... allows you to automatically switch between upper and
  107.     lower case characters for entire words, first letters of words, or
  108.     first letters of lines.
  109.  
  110. *   Shift Left and Shift Right indent the selected text by one tab stop
  111.     (in the case of Shift Left), or outdent by one tab stop (for Shift
  112.     Right). If you hold down the Shift key while choosing one of these
  113.     commands, the selected text will be indented or outdented by one
  114.     space instead of one tab stop.
  115.  
  116. *   The Hard Wrap... command is used for wrapping long lines of text and
  117.     filling paragraphs. Essentially, it uses carriage returns to break
  118.     lines of text, to keep them from running off to the right of your
  119.     screen.
  120.  
  121. *    Insert Line Breaks "freezes" the line breaks in soft-wrapped
  122.     documents, by turning each soft line break into a hard carriage
  123.     return. This is useful when preparing to transmit a soft-wrapped
  124.     document to an environment that doesn't support soft wrapping.
  125.     
  126. *   Remove Line Breaks removes carriage returns and spaces between
  127.     groups of text. Essentially, it performs the reverse function of the
  128.     "Hard Wrap..." command.
  129.  
  130. *   Zap Gremlins... is useful for finding and altering non-printing
  131.     characters in your text files.
  132.  
  133. *   Entab converts runs of spaces into tabs, according to the current
  134.     setting in the "Font and Tabs..." dialog. This transformation is
  135.     useful when downloading text from a mainframe computer or on-line
  136.     service which uses spaces to line up columns of text; when
  137.     displaying the text in a monospaced font, columns will still usually
  138.     not line up unless you Entab the text.
  139.  
  140. *   Detab converts tabs into runs of spaces, according to the current
  141.     setting in the "Font and Tabs..." dialog. This is useful when
  142.     uploading text to a mainframe or on-line service which has no
  143.     concept of tabs as column separators.
  144.  
  145.  
  146. Additional Menu Items
  147.  
  148. Here is a listing of some of the additional functions (or changes to the
  149. behavior of existing functions) which can be invoked by using various
  150. modifier keys. Please remember that BBEdit Lite displays the modified
  151. names of these commands in its menus, so to see the commands in context,
  152. just pull down the menu and press one or more modifier keys.
  153.  
  154.  
  155. Menu    Item            Modifier    New Name            Action
  156. ----    ----            --------    --- ----            ---===
  157. File    Open            Option      Open Several        Open several
  158.                                                         documents in
  159.                                                         one dialog
  160.  
  161.         Open Selection    Option        Reveal Selection    Displays the selected
  162.                                                         file in the Finder
  163.                                                         
  164.         Close           Option      Close All           Closes all
  165.                                                         open documents
  166.  
  167.         Save            Option      Save All            Saves all unsaved
  168.                                                         documents
  169.  
  170.         Save As..       Option      Save As Selection.. Uses selection
  171.                                                         as default name
  172.                                                         for Save As
  173.  
  174.         Print..         Option      Print All..         Prints all open
  175.                                                         documents
  176.  
  177.         Quit..          Option      Transfer..          Run another
  178.                                                         application
  179.  
  180. Edit    Cut             Shift       Cut & Append        Cut & Add to
  181.                                                         Clipboard
  182.  
  183.         Copy            Shift       Copy & Append       Add to Clipboard
  184.  
  185.         Select Line     Option      Select Paragraph    Selects paragraph
  186.                                                         containing current
  187.                                                         line
  188.                                                         
  189. Text    Twiddle         Option      Twiddle Words       Exchange words
  190.  
  191.         Change Case..   Option      Change Case         Use current
  192.                                                         settings
  193.  
  194.         Shift Left      Shift       Shift Left One Space
  195.  
  196.         Shift Right     Shift       Shift Right One Space   
  197.     
  198.         Wrap..          Option      Wrap                Wrap with
  199.                                                         current settings
  200.  
  201.         Unwrap..        Option      Unwrap              Unwrap with
  202.                                                         current settings
  203.  
  204.         Zap "Gremlins"..Option      Zap "Gremlins"      Zap with
  205.                                                         current settings
  206.  
  207.         Entab..         Option      Entab               Use current
  208.                                                         settings
  209.  
  210.         Detab..         Option      Detab               Use current
  211.                                                         settings
  212.     
  213. Search  Enter           Option      Enter
  214.         Search String               Replace String
  215.  
  216.         Find in         Option      Open All Matches    Find in Next File
  217.         Next File                                       until no more found
  218.  
  219.  
  220. Cursor Key Equivalents
  221.  
  222. Sometimes, you may find prefer to do word selection or deletion 
  223. directly from the keyboard. Here are some available shortcuts:
  224.  
  225. Key                        Modifier          Action
  226. ---                        --------        ---===
  227. (left/right) Arrow        (none)            Move 1 character left/right
  228.  
  229. (left/right) Arrow        Option            Move 1 word left/right
  230.  
  231. (left/right) Arrow        Command            Move to beginning/end of line
  232.  
  233. (up/down) Arrow              (none)            Move up/down 1 line in file
  234.  
  235. (up/down) Arrow              Command            Move to top/bottom of file
  236.  
  237. (up/down) Arrow             Option            Move to previous/next screen page
  238.  
  239. [any of the above]        Shift            Make or extend a selection range
  240.  
  241. Delete                       (none)            Deletes selection range, or character
  242.                                         preceding the insertion point.
  243.  
  244. Delete                    (Command)        Deletes all characters backwards
  245.                                         to beginning of line
  246.                                         
  247. Delete                    (Option)        Deletes all characters back to
  248.                                         beginning of word
  249.                                         
  250. There is an option to "Exchange Command & Option" key effects in the
  251. Editor section of the Preferences, for those who may be used to some
  252. older environments which behaved this way. If this option is activated,
  253. the behavior of the Left and Right arrow key equivalents will change
  254. accordingly.
  255.  
  256.  
  257. Special Keys
  258.  
  259. The Apple Extended Keyboard has additional function keys on it, which are
  260. usable within BBEdit Lite:
  261.  
  262. Key                    Action
  263. ---                    ---===
  264. F1                    Undo
  265.  
  266. F2                    Cut
  267.  
  268. F3                    Copy
  269.  
  270. F4                    Paste
  271.  
  272. "del"                Forward Delete
  273.  
  274. Home/End            Scroll to start/end of document
  275.  
  276. Cmd-Home/End        Move insertion point to start/end of document
  277.  
  278. Page Up/Down        Scroll up/down a page
  279.     
  280.  
  281. ===
  282.  
  283. More on Wrapping
  284.  
  285. BBEdit Lite offers the capability to wrap text in a variety of ways. One
  286. method of wrapping is the "soft" or "live" word wrapping that
  287. word-processors provide;  it is useful when importing text files from
  288. word processors or other programs that do not use carriage returns to
  289. break lines on the screen. When opened, such files appear to have only a
  290. few lines in them, which run far past the right-hand edge of the window.
  291. Soft text wrapping is also useful when you are writing text that will
  292. be exported to a word processor or page-layout program, as well as in
  293. other situations in which paragraphs are separated by carriage returns.
  294.  
  295. For composing text in situations where carriage returns are a line
  296. separator (rather than a paragraph separator), "hard" text wrapping is
  297. useful for formatting your text.
  298.  
  299. To hard-wrap text in the current document window, choose "Wrap..." from
  300. the Text menu.
  301.  
  302. The controls on the left half of the "Wrap..." dialog box control how much
  303. of the text is wrapped, and the maximum length of the lines after
  304. wrapping.
  305.  
  306. The group of radio buttons controls the length of lines after they have
  307. been wrapped:
  308.  
  309. *    The "Philip Bar" button will break lines of text at the philip bar.
  310.     (To see the location of the philip bar, turn on "Show Philip Bar" in
  311.     the Windows section of the Preferences dialog.) The philip bar
  312.     indicates the maximum usable width of adocument window when the
  313.     window is zoomed to full size on a nine-inch "classic" Macintosh
  314.     screen. For this reason, you are guaranteed that text wrapped to the
  315.     philip bar will be readable without horizontal scrolling by anyone
  316.     on any Macintosh.
  317.  
  318. *    If "Window Width" is selected, no wrapped line will be longer than
  319.     the current width of the window. This option is useful if you'd like
  320.     the lines to be alittle longer or a little shorter than is provided
  321.     for by the philip bar; just size the window appropriately and wrap.
  322.  
  323. *    If "Character Width" is selected, the number in the text field
  324.     designates the maximum number of characters allowed on any line; a
  325.     line that exceeds this number of characters in length will be
  326.     wrapped. The "Character Width" setting is useful for preparing
  327.     postings to on-line services, which can break lines in an
  328.     unattractive fashion if they're longer than a fixed number of
  329.     characters (usually 80).
  330.  
  331. The controls on the right half of the dialog control paragraph wrapping.
  332. If the "Paragraph Fill" check box is turned off, long lines will be
  333. wrapped. Short lines will be left untouched.
  334.  
  335. ===
  336.  
  337. Printing
  338.  
  339. BBEdit Lite offers a variety of options for varying your printed output.
  340. These options are available from the dialog that appears when you choose
  341. "Print" from the File menu:
  342.  
  343. The portion of the dialog above the gray line is the normal set of
  344. controls that is provided by whichever printer driver you use. Below the
  345. gray line are controls provided specifically by BBEdit Lite.
  346.  
  347. *    The "Printing Font:" button will bring up a dialog that allows you
  348.     to set the font, size, style, and tab attributes for the text when
  349.     it's printed (as opposed to when it's displayed). For a description
  350.     of the controls in this dialog, see the "Editing" section of this
  351.     document.
  352.  
  353. *    The "Options..." button will present a dialog box for setting
  354.     various formatting options, most of which should be
  355.     self-explanatory.
  356.  
  357. Most of the options in "Options..." dialog only affect the appearance of
  358. the pages that are printed out, and can therefore be set according to
  359. your individual taste.
  360.  
  361. ===
  362.  
  363. Searching
  364.  
  365. BBEdit Lite gives you the ability to search for strings of characters
  366. within the current document, or within multiple files, whether they're
  367. currently open in BBEdit Lite or not. When you choose "Find..." from the
  368. Search menu, BBEdit Lite will present a dialog box with several options.
  369.  
  370. The edit field to the right of "Search For:" contains the string of
  371. characters that you wish to search for. If the "Grep" check box is
  372. checked, the string in this edit field is a regular expression. See
  373. below for more information on grep searching.
  374.  
  375. The edit field to the right of "Replace With:" contains the string of
  376. characters that will replace the current selection whenever you choose
  377. "Replace", "Replace and Find Again", or "Replace All" from the Search
  378. menu.
  379.  
  380. Note: To search for an explicit carriage return, line feed, or tab, you
  381. can type the literal character by holding down the Command key and
  382. hitting the Return or Tab key, or typing "\n" for a line feed, "\r" for
  383. a carriage return, or "\t" for a tab. You can also type Control-J,
  384. Control-M, and Control-I, respectively. To search for a -literal-
  385. occurrence of an escape (for example, in C or Rez program source), use
  386. two backslashes: "\\n", "\\r", and "\\t". Also, a "\\" will be
  387. interepreted to mean a single backslash, just as it does in C.
  388.  
  389. The "Match Case" check box determines whether the search is
  390. case-sensitive or not. If "Match Case" is checked, only text which has
  391. the same combination of upper and lower case letters as the Search For
  392. string will be found.
  393.  
  394. The "Entire Word" check box determines whether the text being searched
  395. must be bounded by word breaks (spaces, dashes, and other punctuation).
  396.  
  397. The "Start at Top" check box will cause the entire document to be
  398. searched, starting at the beginning of the document and proceeding
  399. forward to the end of the document.
  400.  
  401. The "Wrap Around" check box will cause the entire document to be
  402. searched, regardless of where the current insertion point or selection
  403. range lies. Ordinarily, only the text from the start of the selection
  404. range to the end of the document is searched. If "Wrap Around" is turned
  405. on, and the search string isn't found between the start of the selection
  406. range and the end of the document, the search will automatically restart
  407. from the beginning of the document. If the search string is found in the
  408. document after wrapping around, BBEdit Lite will blink the menu bar to alert
  409. you.
  410.  
  411. If the "Search Backwards" check box is checked, BBEdit Lite will search
  412. backwards from the start of the insertion point to the start of the
  413. document, rather than forward to the end of the document. If "Wrap
  414. Around" is checked, and the search string is not found between the start
  415. of the document and the start of the selection range, the backwards
  416. search will resume from the end of the document.
  417.  
  418. If the "Selection Only" check box is checked, BBEdit Lite will search only the
  419. selected range of text.
  420.  
  421. Note: If "Start at Top" is checked, the "Search Backwards", "Selection
  422. Only", and "Wrap Around" options are automatically disabled.
  423.  
  424. After you have entered the search and replace strings and set the search
  425. options appropriately, you can click any of the buttons arrayed along
  426. the right-hand edge of the dialog:
  427.  
  428. -    If you click "Find", BBEdit Lite will search for the current search
  429.     string, using the current search options.
  430.  
  431. -    If you click "Find All", BBEdit Lite will locate all occurrences of the
  432.     search string, using the current search options, and display those
  433.     occurrences in a "Search Results" window.
  434.     
  435. -    If you click "Replace", BBEdit Lite will search for the next occurrence
  436.     of the search string, using the current search options, and replace
  437.     it with the specified replace string.
  438.  
  439. -    If you click "Replace All", BBEdit Lite will locate all occurrences of
  440.     the search string, and replace them with the specified replace
  441.     string.
  442.         
  443. -    If you click "Don't Find", BBEdit Lite will accept the current search
  444.     strings and options, but will not perform the search; you can then
  445.     choose "Find Again" from the Search menu to start the search.
  446.  
  447. Note that if the "Multi-File Search" box is checked, the "Find All" and
  448. "Replace All" buttons will operate across all files that BBEdit Lite locates
  449. using the indicated search method and starting point.
  450.  
  451. ===
  452.  
  453. Multi-File Searching
  454.  
  455. BBEdit Lite also provides a variety of means for searching through multiple
  456. text files at one time in order to locate the search string. To perform
  457. a multi-file search, check the "Multi-File Search" check box in the
  458. Find... dialog.
  459.  
  460. The popup menu next to "What:" determines how BBEdit Lite will locate the
  461. files to be searched.
  462.  
  463. There are three ways to locate files:
  464.  
  465. *    Directory Search. When this search method is chosen, BBEdit Lite
  466.     scans through the folders starting at the one you choose, and each
  467.     file that it encounters will be searched for the search string.
  468.  
  469. *    Open Windows. When you choose this search method, BBEdit Lite
  470.     searches for the search string only in document windows that are
  471.     currently open. This sort of search is very fast, and may be most
  472.     convenient if you wish to limit the scope of your search to a few
  473.     files.
  474.  
  475. *    Search Results. This search method is only available when the
  476.     "Search Results" window is open and contains the results of a
  477.     previous Batch Find (see below).
  478.  
  479. The check boxes can be used to tailor the search to your needs:
  480.  
  481. *    Batch Find accumulates the results of the search in progress and
  482.     displays them all at once in a Search Results window. If this check
  483.     box is not checked, then the multi-file search will stop each time
  484.     it encounters a match, and open the file that contains the match.
  485.  
  486. Once the Search Results window is opened, you can single-click on an
  487. entry in the window to display any given match, or double-click on an
  488. entry to open the file containing that match.
  489.  
  490. *    Search Nested Folders causes the Directory Scan search to search
  491.     folders which are enclosed in the search's starting directory. If
  492.     this check box is turned off, only the files in the starting
  493.     directory will be searched.
  494.  
  495. *    Skip (...) Folders causes the Directory Scan to skip folders whose
  496.     names are enclosed in parentheses. This is useful if you have
  497.     folders containing text files that you do not want to search for one
  498.     reason or another; just enclose the folders' names in parentheses,
  499.     and they will be skipped.
  500.  
  501. The "File Type" and "File Name" pop-up menus give you control over the
  502. types of files that BBEdit Lite will search. Choose "Any File" from the menu
  503. to search files of all kinds, regardless of whether they contain actual
  504. text or not. Choose "Text Files" to limit the search to known text
  505. files.
  506.  
  507. When BBEdit Lite performs a multi-file search, it does so in two steps.
  508. First, it constructs a list of the files to be searched, using the
  509. search method specified in the Multi-File Search Options dialog. Second,
  510. it searches each file in the list for the search string. If "Batch Find"
  511. is selected, all occurrences in each file will be displayed in the
  512. Search Results window. Otherwise, each file will be opened to display
  513. the first occurrence of the search string; you can find subsequent
  514. occurrences of the search string in the same file by choosing "Find
  515. Again" from the Search menu. If you are not using Batch Find, you can
  516. locate the next file that contains the search string by choosing "Find
  517. In Next File" from the Search menu.
  518.  
  519. You can combine the capabilities of BBEdit Lite's multi-file search with
  520. the Replace All command to perform multi-file replace operations. To do
  521. this, set up a multi-file search as desired, and click the "Replace All"
  522. button in the Find dialog.
  523.  
  524. Once BBEdit Lite has constructed the list of files to search, it will
  525. present a dialog containing options for the replace operation:
  526.  
  527. There are three levels of safety that are available:
  528.  
  529. *    Safest. Click on the "Leave Open" radio button. For each file that
  530.     contains the search string, BBEdit Lite will perform a "Replace All"
  531.     on that file, and leave the file open so that you can inspect the
  532.     changes.
  533.  
  534. *    Less Safe. Click on the "Save To Disk" radio button, and make sure
  535.     that the "Confirm Saves" check box is checked. BBEdit Lite will
  536.     perform a Replace All on each file that contains the search string,
  537.     and then ask you what to do.
  538.  
  539. If you click "Save", BBEdit Lite will save the changed file. If you click
  540. "Don't Save", BBEdit Lite will throw away the changes that were just
  541. performed. If you click "Leave Open", BBEdit Lite will leave the file open;
  542. this is the same behavior as the "Safest" case, above. If you click
  543. "Cancel Search", BBEdit Lite will stop the multi-file replace operation.
  544.  
  545. *    Living on the Edge. Click on the "Save to Disk" radio button, and
  546.     un-check the "Confirm Saves" check box. If you do this, BBEdit Lite
  547.     will perform a Replace All on each file that contains the search
  548.     string, and then save the changed file to disk without asking. You
  549.     should only use these settings if you are absolutely certain of what
  550.     you are doing, since the changes are irreversible.
  551.  
  552. ===
  553.  
  554. Grep Searching
  555.  
  556. Grep is a method of pattern matching that derives from the Unix(TM)
  557. operating system.  You are probably familiar with simple pattern
  558. matching from using word processors;  when you ask a word processor to
  559. find all instances of the word "black", it is performing a simple
  560. pattern match, where each letter has to match literally.  Matching
  561. strings in this manner is not very hard.
  562.  
  563. The ability to match strings in a more general manner is both more
  564. powerful and more complicated.  It allows for sophisticated pattern
  565. matching operations, such as matching all words that begin with the
  566. letter "P" and end with the letters "er", or deleting the first word of
  567. every line.  Grep provides a powerful means of doing this.
  568.  
  569. To use Grep for searching documents, just check the "Grep" check box in
  570. the Find... dialog.
  571.  
  572. The popup menu next to the "Patterns:" in the dialog contains a list of
  573. your most commonly-used Grep patterns. You can change this list in the
  574. "Grep Patterns" section of the Preferences... dialog.
  575.  
  576.  
  577. How Grep Works
  578.  
  579. The "grep" mode of searching and replacing is a powerful tool. Although
  580. somewhat slower than normal text searching, grep allows the user to
  581. search for one of a set of many strings instead of a particular string. 
  582. As a simple example, you can search for any occurrence of an identifier
  583. beginning with the letter P, or all lines that begin with a left brace.
  584.  
  585. A pattern is a string of characters that, in turn, describes a set of
  586. strings of characters.  An example of a set of strings is the set of all
  587. strings that begin with the letter P and end with the letter r;  the
  588. strings "Ptr" and "ProcPtr" are members of this set.  We say that a
  589. string is matched by a pattern if it is amember of the set described by
  590. the pattern.  Patterns are composed of sub-patterns which are patterns
  591. in themselves;  this is how complicated patterns may be formed.
  592.  
  593. The following section goes through the grep pattern matching and
  594. replacement rules step by step, so that by the end of it you should be
  595. able to understand how each of these grep patterns works and be able to
  596. make your own.
  597.  
  598. In some cases, the state of case sensitivity affects the results of a
  599. pattern match.  We have noted below when this is the case.
  600.  
  601. 1. Any character, with certain exceptions described below, is a pattern
  602. that matches itself.
  603.  
  604. 2.    A pattern x followed by a pattern y forms a pattern xy that matches
  605. any string Bu where B can be matched by x and u can be matched by y.  We
  606. can, of course, take the compound pattern xy and concatenate yet another
  607. pattern z onto it, forming the pattern xyz.
  608.  
  609. 3.    The character . is a pattern that will match any character.
  610.  
  611. 4.    The character \ followed by any character except one of the digits
  612. 1-9 is a pattern that matches that character. (You would use this to
  613. find special characters, such as the . character. To search for a
  614. period, you would use \.).
  615.  
  616. 5.    A string of characters s surrounded by square brackets ([ and a ])
  617. forms a pattern [s] that matches a single instance of one of the
  618. characters in the string s.  Note that the case sensitivity flag does
  619. not apply to characters between square brackets:  letters must match
  620. exactly.
  621.  
  622. 5a.     The pattern [^B] matches any character that is not in the string
  623. B. Special characters will be taken literally in this context.  Again,
  624. case sensitivity doesn't apply to characters between square brackets.
  625.  
  626. 5b.    If a string of three characters in the form [a-b] occurs in the
  627. pattern p, this represents all of the characters from a to b inclusive. 
  628. All special characters are taken literally;  i.e., [!-.] denotes the
  629. characters from ! to .. Notice that the only way to include the
  630. character ] in p is to make it the very first character.  Likewise, the
  631. only way to include the character - in p is to have it either at the
  632. very beginning or the very end of p.  Single characters and ranges may
  633. both be used between brackets.
  634.  
  635. 6a.    Any pattern p formed by any combination of rules 1 or 3-5b
  636. followed by a * forms the pattern p* that matches zero or more
  637. consecutive occurrences of characters matched by p.
  638.  
  639. 6c.    Any pattern p formed by any combination of rules 1 or 3-5b
  640. followed by a ? forms the pattern p? that matches zero or one
  641. consecutive occurrences of characters matched by p.
  642.  
  643. We now have the ability to form patterns that are composed of
  644. sub-patterns, and will find it useful to "remember" sub-strings matched
  645. by sub-patterns and to be able to match against those substrings.
  646.  
  647. 7.    A pattern surrounded by ( and ) is a pattern that matches whatever
  648. the sub-pattern matches.  This is useful for matching two or more
  649. instances of the same string and when doing replacements.
  650.  
  651. Sometimes it is useful to be able to "constrain" patterns to match only if
  652. certain conditions in the context outside the string matched are met.
  653.  
  654. 8.    A pattern p that is preceded by a ^ forms a pattern ^p.  If the
  655. pattern ^p is not preceded by any other pattern, it matches whatever p
  656. matches as long as the first character matched by p occurs at the
  657. beginning of a line.  If the pattern ^p is preceded by another pattern,
  658. then the ^ is taken literally.
  659.  
  660. 9.    A pattern p that is followed by a $ forms a pattern p$.  If the
  661. pattern p$ is not followed by any other pattern, it matches whatever p
  662. matches as long as the last character matched by p occurs at the end of
  663. a line.  If the pattern p$ is followed by another pattern, then the $ is
  664. taken literally.
  665.  
  666. Note that the characters ^ and $ constrain pattern matches to begin or
  667. end at line boundaries, and so can be combined to constrain a pattern to
  668. match an entire line only (as in the above example).
  669.  
  670. Grep provides not only a more sophisticated method of searching, but a
  671. sophisticated method of replacing as well.  In a replacement string, the
  672. following substitutions are made before any text replacement occurs:
  673.  
  674. 1.    Each occurrence of the character & is replaced with whatever was
  675. last matched by the entire pattern.
  676.  
  677. 2.    Each occurrence of a string of the form \n, where n is one of the
  678. digits 1-9, is replaced by whatever was last matched by the sub-pattern
  679. beginning with the nth occurrence of (.
  680.  
  681. 3.    Each occurrence of a string of the form \p, where p is other than
  682. one of the digits 1-9, is replaced by p.
  683.  
  684. This allows you to not only be able to search for a string satisfying a
  685. complex set of conditions, but also to be able to do a subsequent
  686. replacement that varies depending on the string that is matched. Note
  687. that this does not take into account escape sequences, such as \t, \r,
  688. \n, \\, etc. Suppose that you have written a program that is to become a
  689. Macintosh application (i.e., it uses the Macintosh ToolBox instead of
  690. stdio for the user interface).  Suppose also that you have discovered
  691. that you have forgotten to put a \p at the beginning of your string
  692. constants, so that your program is trying to pass C strings instead of
  693. Pascal strings to the Toolbox (which only knows how to deal with Pascal
  694. strings).  You can easily change all your C strings to Pascal strings by
  695. specifying "(.*)" as the search pattern and "\\p\1" as the replacement
  696. string.
  697.  
  698. Suppose you decided to reverse the two arguments of the function "foo". 
  699. You might try the pattern foo\(([^,]*),([^)]*)\) as the search pattern
  700. and foo(\2, \1) as the replacement pattern.  How does the search pattern
  701. work?
  702.  
  703. Let's assume we're trying to match some text that looks like foo(1,*bar)
  704.  
  705.     foo\(([^,]*),([^)]*)\)    matches    foo(1,*bar)
  706.  
  707. Since ([^,]*) matched 1 and ([^)]*) matched *bar, the two arguments to
  708. foo, the replacement pattern foo(\2, \1) will result in foo(*bar, 1)
  709.  
  710. This, unfortunately, won't work in the case of foo(1,(*bar)+2), since
  711. ([^)]*) will match only up to the first right parenthesis, leaving +2)
  712. unmatched.  If we're sure that all calls to foo end with a semicolon,
  713. however, we can change our pattern to foo\(([^,]*),([^;]*)\);. In this
  714. pattern, instead of trying to match the second argument by matching
  715. everything up to the first right parenthesis, we match everything up to
  716. the ); which terminates the invocation of foo.
  717.  
  718. In this example we showed how to analyze a grep pattern by examining
  719. sub-patterns. This is a good way of figuring out how to build a pattern
  720. as well. Grep can be thought of as a small and rather cryptic
  721. programming language, with each pattern a program and sub-pattern a
  722. statement in this language. If you try to create a grep pattern by
  723. testing a small sub-pattern, then adding and testing additional
  724. sub-patterns until the complete pattern is built, you may find building
  725. complex grep patterns not nearly as daunting as you first thought.
  726.  
  727. ===
  728.  
  729. Preferences Dialog
  730.  
  731. To bring up the Preferences dialog, choose "Preferences..." from the Edit
  732. menu, or double-click on your BBEdit Lite Prefs file. (This may not be
  733. convenient, since the BBEdit Lite Prefs file usually resides somewhere within
  734. the System Folder.)
  735.  
  736. The list on the left-hand side of the dialog determines which section of
  737. the preferences you are looking at. If you click on "Save", all of the
  738. preferences settings will be saved to the "BBEdit Lite Prefs" file. If you
  739. click on "Cancel", the existing preferences will be left alone, and any
  740. changes you've made in the Preferences settings will be discarded.
  741.  
  742. --> The "Editor" preferences control BBEdit Lite's editing and keyboard
  743. behavior. These settings establish the defaults for newly-created
  744. documents, as well as for text files that don't already contain BBEdit Lite
  745. state information.
  746.  
  747. *    The "Default Font" button sets the font which will be used to
  748.     display the text in newly created windows, and for documents which
  749.     have no saved state information.
  750.  
  751. *    If "Auto-Indent" is turned on, BBEdit Lite will indent to the start
  752.     of the preceding line whenever you type the "Return" key on the
  753.     keyboard. This is useful for programmers and for reverse-indenting
  754.     text. It may be less convenient if you are using BBEdit Lite for
  755.     composing prose.
  756.  
  757. *    Soft Wrap Text: generally, BBEdit Lite does not automatically wrap
  758.     text as you type it in, which means the text may scroll
  759.     horizontally. Selecting this option tells BBEdit Lite to wrap the
  760.     text to the width of the window as you insert and delete text, and
  761.     whenever you are-size the document's window.
  762.  
  763. *    If Balance While Typing is turned on, BBEdit Lite will flash
  764.     matching parentheses, curly braces, and brackets as you type them.
  765.  
  766. *    Smart Quotes is used to determine the default value of the Smart
  767.     Quotes setting for newly created windows and for documents saved
  768.     with state information other than "BBEdit Lite".
  769.  
  770. *    Ordinarily, actions such as Entab, Detab, Zap Gremlins, and Replace
  771.     All are not undoable, and BBEdit Lite will alert you if you are
  772.     about to perform a non-undoable action. If you are not concerned
  773.     about being able to undo these actions, and do not want BBEdit Lite
  774.     to alert you, turn on the 'No "Can't Undo" Alerts' check box, and
  775.     BBEdit Lite will not alert you of these actions.
  776.  
  777. *    Exchange Command and Option reverses the meaning of the Command and
  778.     Option keys when used with the left and right arrow keys. See
  779.     "Editing Text with BBEdit Lite" for more details.
  780.  
  781. *    If Use Keypad for Cursor Control is checked, the keys on the
  782.     numeric keypad (on keyboards that have them) will move the cursor.
  783.     See "Editing Text With BBEdit Lite" for more details.
  784.  
  785. --> The "File Search" section of the Preferences controls BBEdit Lite's
  786. behavior when searching for files via the "Open Selection" command. If
  787. "Skip (...) Folders" is checked, BBEdit Lite will ignore folders whose
  788. names are enclosed in parentheses. The "Default <...> Directory" setting
  789. determines where BBEdit Lite will start its search of the file's name is
  790. enclosed in <angle brackets>. If "Follow Aliases" is checked, BBEdit
  791. Lite will resolve any folder aliases it encounters during its search.
  792.  
  793. --> The "File Types" section of the Preferences allows you to modify the
  794. list of file creators that appears in the "File Creator" popup menu of
  795. the "Save As..., Options..." dialog box.
  796.  
  797. To add a new application's file creator to the list, click the "Add..."
  798. button, and choose the application. To change an application's creator
  799. signature, click on an application name in the list, enter a new
  800. four-letter code in the text field next to "Creator...", and click the
  801. "Change" button. You can use the "Set button to pick an application and
  802. enter its creator code in the text field for you. To remove an
  803. application creator from the list, click on an application name, and
  804. click the "Delete" button.
  805.  
  806. The creators for "BBEdit Lite" and "Generic Text File" are built into
  807. BBEdit Lite and cannot be changed or deleted.
  808.  
  809. --> The "Filing" settings control the default settings for the Open... and
  810. Open Several... dialogs. If "Wrap TeachText Files" is checked, then BBEdit Lite
  811. Lite will always soft-wrap files which have been created by TeachText
  812. (or its successor SimpleText). If "Auto-Backup" is checked, a backup
  813. will automatically be made of afile every time it is saved.
  814.  
  815. --> The "Grep Patterns" of the Preferences dialog allows you to modify
  816. the list of regular expressions which appears in the popup menu next to
  817. the "Grep" check box in the "Find..." dialog. The scrolling list box shows
  818. the names of the installed patterns. When you click on one, the text
  819. fields below the list will be filled in with its name, search pattern,
  820. and replace pattern. You can change any of these text fields, and click
  821. "Change" to replace the selected pattern with the changed one. You can
  822. also enter new information in the text fields and click "Add" to add a
  823. new pattern, or select a pattern and click "Delete" to remove it from
  824. the list.
  825.  
  826. Note: You can install a pattern with an empty replace pattern, which is
  827. useful just for locating text which matches a particular regular
  828. expression.
  829.  
  830. --> The "Printing" settings provide the default print settings for new
  831. windows and for documents which have saved state information other than
  832. BBEdit Lite's.
  833.  
  834. These settings correspond to the same settings on the "Options..." dialog
  835. which can be brought up from the Print... dialog.
  836.  
  837. --> The "Search Folders" section presents a list of folders which will
  838. appear in the "Folder:" pop-up menu in the "Find" dialog.
  839.  
  840. --> The "Startup" settings determine BBEdit Lite's behavior when it's
  841. launched without any documents.
  842.  
  843. The "At Startup:" radio buttons control what BBEdit Lite does when it's
  844. launched by some means other than double-clicking on a BBEdit Lite document,
  845. or by dragging and dropping some item onto BBEdit Lite itself (under System
  846. 7).
  847.  
  848. *    If Nothing is selected, BBEdit Lite will take no action at startup.
  849.     This is handy if BBEdit Lite regularly gets launched into the
  850.     background, or is launched by some scripting utility which will then
  851.     start feeding commands to BBEdit Lite directly.
  852.  
  853. *    New Window causes BBEdit Lite to bring up a new untitled window, as
  854.     if the "New command on the File menu had been chosen.
  855.  
  856. *    Open causes BBEdit Lite to bring up an "Open..." dialog, as if the
  857.     "Open..." command on the File menu had been chosen.
  858.  
  859. *    Open Several causes BBEdit Lite to bring up the "Open Several..."
  860.     dialog, as if that command had been chosen.
  861.  
  862. --> The "State" settings control what parts of a file's saved state are
  863. honored whenever a file with saved state information is opened. In some
  864. cases, it may be desirable to ignore one of these aspects of the saved
  865. state.
  866.  
  867. The "Remember File State" setting establishes whether BBEdit Lite will
  868. remember information about the document's state (window position, font
  869. and size settings, and other options). This default is applied to newly
  870. created documents. If "Always Add State" is checked, BBEdit Lite will
  871. remember state information for documents that you open which don't
  872. already have saved state information.
  873.  
  874. --> The "Text Search" settings provide the defaults for text searching and
  875. multi-file searching. The options in this dialog correspond to their
  876. counterparts in the Find... and the Multi-File Search Options dialog.
  877.  
  878. The "Start From..." button sets the default starting directory for
  879. Directory Scan multi-file searches.
  880.  
  881. --> The "Windows" settings affect the appearance and behavior of
  882. BBEdit Lite's document windows.
  883.  
  884. *    Delay When Scrolling makes BBEdit Lite wait a tenth of a second when
  885.     you click in the arrows of a scrollbar before scrolling the text in
  886.     a document window. This is most useful under System 6 on faster
  887.     machines; often several lines will go by before your reflexes allow
  888.     you to let go of the mouse button. System 7 offers a "scrolling
  889.     throttle", so this setting may be turned off.
  890.  
  891. *    Show Status Bar causes the status bar to be visible within all
  892.     editing windows. (See "Editing Text With BBEdit Lite" for a
  893.     description of the status bar.) This option is on by default; you
  894.     can turn it off if you have a small screen and screen "real estate"
  895.     is at a premium.
  896.  
  897. *    Show Philip Bar draws a vertical gray line in the status bar at the
  898.     point where the visible editing area ends on a 9-inch "classic"
  899.     screen. See above for more details.
  900.  
  901. *    Show Tab Stops places tick marks in the status bar to indicate the
  902.     position of tab stops in each editing window. This option is dimmed
  903.     if "Show Status Bar" is turned off.
  904.  
  905. *    Show Line Numbers places line numbers along the left edge of each
  906.     editing window.
  907.  
  908. *    Show Cursor Position places the cursor-position display at the
  909.     lower left corner of each editing window; this display shows the
  910.     position of the insertion point, or the last-changed end of the
  911.     selection range.
  912.  
  913. The settings under "Window Zooming" control the maximum width to which
  914. BBEdit Lite will open documents, either by default or when using the
  915. zoom-box control in the upper right-hand corner of the window; the "Zoom
  916. Windows To" setting determines where BBEdit Lite will place windows that
  917. are zoomed on multiple-screen systems.
  918.  
  919. If either of the check boxes under the "Leave Room for Finder" is
  920. checked, BBEdit Lite will make certain that there's enough space below
  921. and/or to the right of any window so that icons on the desktop are not
  922. obscured by the edges of the Window.
  923.  
  924. Note - if you are running on a Macintosh with a 9-inch screen, the
  925. window sizes when either of these options is checked are usually too
  926. small to be useful. Therefore, you may want to turn these options off if
  927. you have a small screen.
  928.  
  929. ===
  930.  
  931. Parting Shots
  932.  
  933. Be sure to read the "About BBEdit Lite" document which comes with the
  934. BBEdit Lite software package for complete information on the license
  935. requirements and other details. If you wish to get in touch with us for
  936. any reason, here's how:
  937.  
  938. Postal:        Bare Bones Software, Inc.
  939.             P.O. Box 1048
  940.             Bedford, MA  01730-1048
  941.  
  942. Web page:    http://www.barebones.com/
  943.  
  944. Email:      bbsw@barebones.com
  945.  
  946. Phone:      +1 617 778 3100
  947. Fax:        +1 617 778 3111
  948.  
  949. Please note that we cannot provide technical support for BBEdit Lite or
  950. our other freeware products via phone or fax; however, if you contact us
  951. via email, we will be happy to assist you.
  952.  
  953. =============================================================================
  954. All products mentioned are trademarks or registered trademarks of their 
  955. respective holders.
  956.  
  957. This document is written by and copyright (c)1995-1996 by Bare Bones
  958. Software, Inc. It may be redistributed freely as long as it is not
  959. modified in any way. Information presented here is accurate as of the
  960. time of writing, but is subject to change without notice.
  961.  
  962. BBEdit Lite is copyright (c)1992-1996 Bare Bones Software, Inc., all
  963. rights reserved. Please see the enclosed informational material for
  964. license requirements.
  965.  
  966. =end=
  967.  
  968.  
  969.  
  970.